<?
/**
* EXAMPLE 3
*	based on the submitTroughImage.class.php
*	by: Daantje Eeltink
*	License: GPL
*
*	Example with hardisk backend...
*/

//init class
include_once("submitTroughImage.class.php");
$sti = new submitTroughImage();

//have set backend first! checkPost() depands on it!!
//this directory should be writable for the webserver!!
//for better security, use a path outside your webserver root!
$sti->setBackendPath('sti_tmp');


//check post. Returns null when tot posted...
if($sti->checkPost() === true){
	echo "<h1>Thank you, they mached!</h1>";
}elseif($sti->checkPost() === false){
	echo "<h1>Wrong input! Try again!</h1>";
}


//use these fonts at random. Could add more if you want.
$sti->setFont("fonts/DESTROY_.TTF");


//set custom background image
$sti->setBackgroundImage("background.jpg");

//set colors RGB or HEX
$sti->setColor("255,0,0");
$sti->setColor("0,255,255");
$sti->setColor("#ff9900");

//set the amount of char in the code...
$sti->setCharAmount(6);

//set string type. (int, char or varchar)
$sti->setStringType('char');

//create image
$sti->createImage(100,25);



//PARSE FORM
?>

<h2>example 3:</h2>
Harddisk backend, background image, custom width and height, and a letter only string.<br>
<hr>

<form action=example3.php method=post>

<!-- with the hardisk backed the parseImage() needs the md5 key -->
<img src="image.php?<?=$sti->getKey();?>" border=1><br>

<!-- we need to make the md5 key also a hidden form field -->
<?=$sti->parseKeyInput();?>

<!-- this is the same as the other examples -->
code: <?=$sti->parseStringInput();?> (<a href="example3.php">Can't read code?</a>)<br>
<br><input type=submit>
</form>

<?
//parse errors when there are any...
echo $sti->error();
?>

<hr>
<a href="example1.php">Example 1</a> |
<a href="example2.php">Example 2</a> |
<a href="example3.php">Example 3</a> |
<a href="example4.php">Example 4</a>


<?
echo $_SESSION['map'].'asf';
?>